package com.aclass.wang.c206;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    Map<Integer, Class> mTestItems = new HashMap<>();

    //AppCompatActivity是为了兼容老版本而设立的兼容版的Activity，正宗的Activity是位于android.app包下的android.app.Activity

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //mTestItems.put(R.id.btn_test7, Main6Activity.class);
        mTestItems.put(R.id.btn_test8,Main8Activity.class);//转到定位与传感器
        mTestItems.put(R.id.btn_test9,Main9Activity.class);//转到第一阶段学习

        /*
        Button startMain4Activity = (Button) findViewById(R.id.btn_test5);
        startMain4Activity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Main4Activity.class);
                startActivity(intent);
            }
        });

        Button startMain5Activity = (Button) findViewById(R.id.btn_test6);
        startMain5Activity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Main5Activity.class);
                startActivity(intent);
            }
        });
        */
    }

    public void onClick(View view) {
        Class dst = mTestItems.get(view.getId());
        Intent intent = new Intent(this, dst);
        startActivity(intent);
    }

    /*
    public void onClick(View view){
        switch (view.getId()){
            //#rgb #rrggbb #aarrggbb  a:透明度
            case R.id.btn_red:
                text2.setTextColor(0xFFFF0000);
            case R.id.btn_green:
                text2.setTextColor(0xFFFF8888);
        }
    }
    */

}
